<template>
  <div id="app">
   <mt-header fixed title="牛牛商城">
<span slot="left"@click ="goback" v-show="flag"> <mt-button icon="back">返回</mt-button></span>
   </mt-header>
   <nav class="mui-bar mui-bar-tab">
      <router-link class="mui-tab-item " to="/">
        <span class="mui-icon mui-icon-home"></span>
        <span class="mui-tab-label">首页</span>
      </router-link>
      <router-link class="mui-tab-item" to="/merber">
        <span class="mui-icon mui-icon-contact"></span>
        <span class="mui-tab-label">会员</span>
      </router-link>
      <router-link class="mui-tab-item" to="/car">
        <span class="mui-icon mui-icon-extra mui-icon-extra-cart"><span class="mui-badge">{{$store.getters.getAllCount}}</span></span>
        <span class="mui-tab-label">购物车</span>
      </router-link>
      <router-link class="mui-tab-item" to="/search">
        <span class="mui-icon mui-icon-search"></span>
        <span class="mui-tab-label">搜索</span>
      </router-link>
    </nav>
    <router-view></router-view>
  </div>
</template>

<script>
import mui from './mui.min.js' 
export default {
  name: 'App',
  data(){
  return({
  flag :false
  })
  
  },
  methods:{
  goback(){
  this.$router.go(-1)
  }
  },
  created(){
  mui.init(),
  this.flag = this.$route.path==="/"?false:true
  },
  watch:{
  "$route.path":function(newval){
    if(newval ==="/"){
    this.flag =false
    }else{
    this.flag =true
    }
  }
  }
}
</script>

<style>
#app{
  padding-top:40px;
  padding-bottom:50px;
};

</style>
